package cloud.seri.iot.manager.service.dto

import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import javax.validation.constraints.DecimalMax
import javax.validation.constraints.DecimalMin
import javax.validation.constraints.Max
import javax.validation.constraints.Min
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import java.io.Serializable
import java.util.Objects

/**
 * A DTO for the [cloud.seri.iot.manager.domain.Commodity] entity.
 */
@ApiModel(description = "The commodity entity. @author A true hipster",value = "Commodity")
data class CommodityDTO(

    var id: String? = null,
    /**
     * 商品名称
     */

    @get: NotNull
    @ApiModelProperty(value = "商品名称", required = true)
    var name: String? = null,
    /**
     * 商品原价
     */

    @ApiModelProperty(value = "商品原价")
    var originalPrice: Int? = null,
    /**
     * 现价
     */

    @get: NotNull
    @ApiModelProperty(value = "现价", required = true)
    var currentPrice: Int? = null,
    /**
     * 商品描述
     */

    @ApiModelProperty(value = "商品描述")
    var description: String? = null,
    /**
     * 商品图片
     */

    @ApiModelProperty(value = "商品图片")
    var pic: String? = null,
    /**
     * 状态
     */

    @ApiModelProperty(value = "状态")
    var status: Int? = null

) : Serializable {

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other !is CommodityDTO) return false
        if (other.id == null || id == null) return false

        return Objects.equals(id, other.id)
    }

    override fun hashCode(): Int {
        return id.hashCode()
    }
}
